package org.kaindorf.kainflix.metadata.service.impl;

import org.kaindorf.kainflix.metadata.repository.ProductRepository;
import org.kaindorf.kainflix.metadata.repository.entity.Product;
import org.kaindorf.kainflix.metadata.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class ProductServiceImpl implements ProductService {

    @Autowired
    private ProductRepository productRepository;

    @Override
    public Iterable<Product> getAllProducts() {
        return productRepository.findAll();
    }

    @Override
    public void saveProduct(Product product) {
        productRepository.save(product);
    }

}
